<template>
	<view>
		<!-- <uNavbar title=""></uNavbar> -->
		<view class="succ ">
			<image src="../../static/image/success.png" mode=""></image>
			<text class="f30 c3 ">购买成功</text>
			<text class="f30 c4 mart1" v-if="type==2 || type==1" >藏品已购买，前往我的藏品查看</text>
			<text class="f30 c4 mart1" v-if="type==3" >道具已购买，前往我道具订单查看</text>
			<text class="f30 c4 mart1" v-if="type==4" >商品已购买，前往商品订单查看</text>
			<text class="f30 c4 mart1" v-if="type==5" >生态积分兑换凭证已购买</text>
			<view class="continue flex_c" @click="isContinue">
				<text>继续逛一逛</text>
			</view>
			<text class="f30 c3" v-if="type != 5" @click="goLook()">前往查看</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type:'',
				id:''
			}
		},
		onLoad(e) {
			console.log(e);
			this.type = e.type
			if(this.type == 2){
				this.id = e.id
			}
			uni.removeStorageSync("productCacheInfo")
		},
		methods: {
			isContinue(){
				//获取页面栈的长度
				const canNavBack = getCurrentPages()
				console.log(canNavBack.length);
				// 判断是否刷新了浏览器，刷新了浏览器，页面栈只有当前一个
				if ( canNavBack.length > 1) {
					uni.navigateBack({
						delta: 2
					})
				} else {
					uni.switchTab({
						url:'/pages/index/index'
					})
				}
				// uni.navigateBack({
				// 	delta: 2
				// })
			},
			goLook(){
				console.log(this.type);
				if(this.type == 1){
					uni.redirectTo({
						url: '/pagesMy/myorder/myorder'
					})
				}
				if(this.type==2){
					uni.redirectTo({
						url: '/pagesMy/marketorder/marketorder?id=' + this.id
					})
				}
				if(this.type==3){
					uni.redirectTo({
						url: '/pagesMy/proporder/proporder?id=' + 2
					})
				}
				if(this.type == 4){
					uni.redirectTo({
						url: '/pagesMy/shoppingCenter/shoporder'
					})
				}
			
			}
		},
	}
</script>

<style scoped>
	.succ{
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 690rpx;
		height: 1000rpx;
		margin: 0 auto;
	}
	.succ>image{
		width: 350rpx;
		height: 260rpx;
		margin-bottom: 60rpx;
	}
	.mart1{
		margin-top: 22rpx;
	}
	.continue{
		width: 362rpx;
		height: 100rpx;
		background: linear-gradient(274deg, #AB8E68, #D7BA93);
		border-radius: 80rpx;
		font-size: 36rpx;
		color: #ffffff;
		margin: 88rpx 0 54rpx 0;
	}
	
	

</style>